package com.cloudfun.campusshare.entity;

import com.cloudfun.campusshare.common.constant.BidStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

/**
 * Created by Huqin on 2020/4/8
 */
@Data
@Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "bid")
public class BidEntity extends BaseEntity {

    @Id
    @GenericGenerator(name = "id_uuid", strategy = "uuid")
    @GeneratedValue(generator = "id_uuid")
    @Column(name = "id", nullable = false, unique = true, length = 40)
    private String id;

    @Column(columnDefinition = ("varchar(64) not null comment '名称'"))
    private String name;

    @Column(columnDefinition = ("varchar(64) not null comment '来源网站名称'"))
    private String srcSiteName;

    @Column(columnDefinition = ("varchar(128) not null comment '来源网站地址'"))
    private String srcSiteUrl;

    @Column(columnDefinition = ("varchar(14) not null comment '发布日期'"))
    private String publishTime;

    @Column(columnDefinition = ("varchar(14) not null comment '开标日期'"))
    private String startTime;

    @Column(columnDefinition = ("varchar(14) not null comment '结标日期'"))
    private String endTime;

    @ManyToOne
    @JoinColumn(name = "schoole_id", insertable = false, updatable = false)
    private SchoolEntity school;

    @Column(name = "schoole_id", columnDefinition = ("varchar(40) not null comment '关联学校id'"))
    private String schoolId;

    @Column(columnDefinition = ("text not null comment '正文'"))
    private String content;

    @Column(columnDefinition = ("varchar(32) not null comment '状态'"))
    @Enumerated(EnumType.STRING)
    private BidStatus status;

    @Column(columnDefinition = ("varchar(64) default null comment '中标方'"))
    private String winner;

    @Column(columnDefinition = ("text default null comment '成交公示'"))
    private String publicity;

}
